def eliminateDuplicates(numbers): # DO NOT modify this line 
    # TODO: add your code here
    seen = set()
    result = []
    for number in numbers:
        if number not in seen:
            seen.add(number)
            result.append(number)
    return result

# === DO NOT modify the code below ===
def main():
    list1 = [eval(x) for x in input().split()]
    list2 = eliminateDuplicates(list1)
    print(" ".join(map(str, list1)))
    print(" ".join(map(str, list2)))
    
if __name__ == "__main__":
    main()
# === DO NOT modify the code above ===
